package com.ggb.netty.sixthexample;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.concurrent.EventExecutorGroup;

public class TestServerHandler extends SimpleChannelInboundHandler<MyDataInfo.MyMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, MyDataInfo.MyMessage msg) throws Exception {
        switch (msg.getDataType().getNumber()) {
            case MyDataInfo.MyMessage.DataType.PersonType_VALUE:
                System.out.println("Person "+ msg.getPerson().getName());
                break;
            case MyDataInfo.MyMessage.DataType.DogType_VALUE:
                System.out.println("Dog "+ msg.getDog().getName());
                break;
            case MyDataInfo.MyMessage.DataType.CatType_VALUE:
                System.out.println("Cat "+ msg.getCat().getName());
                break;
        }
    }
}
